const router = require("koa-router")();
const path = require("path");
const dbpool = require("../../pool/dbpool.js");
router.prefix("/" + path.parse(__filename).name);
router.get("/", async function (ctx, next) {
  // ctx.request = {name,sql}
  ctx.body =
    '<html> a <font color="red">' +
    router.opts.prefix +
    "</font> response!</html>";
  await asspool.query(decodeURI(ctx.querystring)).then((resolve, reject) => {
    ctx.body = resolve;
  });
});
module.exports = router;
